'''
Created on Dec 11, 2010

@author: behrooz
'''

def smart_truncate(content, length=128, suffix='...'):
    if len(content) <= length:
        return content
    else:
        return content[:length].rsplit(' ', 1)[0] + suffix
